#version 320 es
#ifdef GL_ES
	precision highp float;
#endif
out vec4 FragColor;

in vec3 position;

struct Trapezoid {
	vec3 topCenter;
	vec3 bottomCenter;
};
uniform Trapezoid trapezoid;

uniform vec3 color;

void main()
{
	vec3 vectorH = trapezoid.topCenter - trapezoid.bottomCenter;
	vec3 vectorP = position - trapezoid.bottomCenter;
	float f = dot(vectorP, vectorH)/ pow(length(vectorH), 2.0);
	FragColor = vec4(color, f);
}